
import psutil

class GetSystemUseInfo():
    def __init__(self) -> None:
        self.Sent_Data=psutil.net_io_counters().bytes_sent
        self.Recv_Data=psutil.net_io_counters().bytes_recv
        
    def GetNetSent(self)->float:
        Sent_Data=psutil.net_io_counters().bytes_sent
        NewSentByte= Sent_Data-self.Sent_Data
        self.Sent_Data=Sent_Data
        return NewSentByte

    def GetNetRec(self)->float:
        Recv_Data=psutil.net_io_counters().bytes_recv
        NewRecvByte= Recv_Data-self.Recv_Data
        self.Recv_Data=Recv_Data
        return NewRecvByte

    def GetCPUInfo(self):
        # cpcList= psutil.cpu_percent(0,True)
        # cpcCount=0
        # for cpc in cpcList:
        #     cpcCount+=cpc

        return psutil.cpu_percent(0,False)

    def GetMemoryInfo(self):
        return psutil.virtual_memory().percent